package com.beta.em.order;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

/**
 * Created by vector on 2016/11/24.
 */
public enum OrderMode {

    BUYING("buying", "订购单"),
    CARTING("carting", "配送单");

    private String value;

    private String cnValue;

    private OrderMode(String value, String cnValue) {
        this.value = value;
        this.cnValue = cnValue;
    }

    public String getValue() {
        return this.value;
    }

    public String getCnValue() {
        return this.cnValue;
    }

    public static OrderMode getOrderMode(String value) {
        return Arrays.stream(values()).filter(orderMode -> StringUtils.equals(orderMode.getValue(), value)).findFirst().orElse(null);
    }

}
